<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>20_数组-es5新增方法-reduce</title>
    </head>
    <body>
        <script>
            var arr = [1,2,3,4,5];

            var result = arr.reduce(function(prev,item){
                console.log(prev,item);
                return prev + item;
            },0);

            console.log(result);
        </script>
    </body>
</html>